<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}" />
<head th:include="fragments/head::header" />

<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
	<div class="main-container-inner">
		<div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
		<div class="main-content">
			<div class="breadcrumbs" id="breadcrumbs">
				<ul class="breadcrumb">
					<li>学生列表</li>
					<li>学生文书列表</li>
				</ul>
			</div>

			<div class="page-content">
				<div class="row">
					<div class="col-xs-12">
						<div class="row">
							<div class="col-xs-12">
								<div th:include="fragments/student_info::student_info" th:style="${session.studentInfoKey == null}? 'display:none'"></div>
								<h3 class="header smaller lighter blue">学生文书列表</h3>
								<input type="hidden" name="studentNo" id="studentNo" th:value="${#httpServletRequest.getParameter('studentNo')}"/>
								<input type="hidden" name="oaid" id="oaid" th:value="${session.user.oaid}"/>
								<div class="table-header" style="height: 42px">
									<form class="form-inline">
										<!--<div class="form-group">-->
											<!--<label for="student_no">学号：</label>-->
											<!--<input type="text" id="student_no" class="form-control input-sm" placeholder="" style="width:100px;"/>-->
										<!--</div>-->
										<!--<button type="button" id="query" class="btn btn-success ">查询</button>-->
										<!--<button type="reset" class="btn btn-warning">清空</button>-->
										<a data-toggle="modal" data-target="#myModal" href="javascript:void(0);" onclick="toAddUrl();"
										   class="btn btn-info pull-right">添加学生文书</a>
										<a th:href="@{/studentInfo}" class="btn btn-info pull-right">学生列表</a>
									</form>
								</div>

								<div class="table-responsive">
									<div id="alert" class="alert alert-success" style="display: none;" role="alert">
										<button type="button" class="close" data-dismiss="alert" aria-label="Close">
											<span aria-hidden="true">&times;</span>
										</button>
										<span id="alertText"></span>
									</div>
									<table id="sample-table-2" class="table table-striped table-bordered table-hover">
										<thead>
										<tr>
											<th width="8%">学号</th>
											<th width="16%">申请院校名称</th>
											<th width="11%">课程名称</th>
											<th width="11%">专业名称</th>
											<th width="11%">学生确认结果</th>
											<th width="11%">文书</th>
											<th width="11%">操作人</th>
											<th width="12%">操作时间</th>
											<th width="12%">操作</th>
										</tr>
										</thead>
									</table>
								</div>
							</div>
						</div>
					</div>
					<!-- /.col -->
				</div>
				<!-- /.row -->
			</div>
			<!-- /.page-content -->
		</div>

		<div th:include="fragments/bottom::bottom"></div>
	</div>

	<a href="#" id="btn-scroll-up"
	   class="btn-scroll-up btn btn-sm btn-inverse"> <i
			class="icon-double-angle-up icon-only bigger-110"></i>
	</a>
</div>
<!-- /.main-container -->

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
	 aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content"></div>
	</div>
</div>
<div th:include="fragments/js::js"></div>

<script th:src="@{/assets/js/jquery.validate.min.js}"></script>
<script th:src="@{/assets/js/jquery.validate.zh-CN.js}"></script>
<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/business/followService/followService.js}" charset="UTF-8"></script>
<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
</body>
<script type="text/javascript">
    var oTable1;
    jQuery(function($) {
        oTable1 = $('#sample-table-2').dataTable({
            "bFilter" : false,//是否使用搜索
            "bProcessing" : true,
            "bDeferRender" : true,//
            "sPaginationType" : "bs_normal",//分页样式
            "bRetrieve" : true,//是否调用后台
            "bServerSide" : true,//是否以后台分页
            "bAutoWidth": true,
            "fnRowCallback": function (nRow, aData, iDisplayIndex) {
//                if (aData.studentConfirmUrl.length > 10) {
//                    $('td:eq(2)', nRow).html( '<a class="blue" href="javascript:void(0);" onclick="toUrl(\''+aData.studentConfirmUrl+'\')">'+aData.studentConfirmUrl.substr(0, 30)+"……"+'</a>');
//                }
//                if (aData.copyUrl.length > 10) {
//                    $('td:eq(3)', nRow).html( '<a class="blue" href="javascript:void(0);" onclick="toUrl(\''+aData.copyUrl+'\')">'+aData.copyUrl.substr(0, 30)+"……"+'</a>');
//                }
            },
            "sAjaxSource" : "/copyInfo/list/data",//请求路径
            "fnServerData" : function(sSource, aoData, fnCallback) {
                aoData.push(
                    <!--{"name":"applyStatus","value":$("#applyStatus").val()!=""? $("#applyStatus").val():null},-->
                    <!--{"name":"visitType","value":$("#visitType").val()!=""? $("#visitType").val():null},-->
                    {"name":"studentNo","value":$("#studentNo").val()}
                )
                $.ajax({
                    "dataType" : 'json',
                    "type" : "GET",
                    "url" : sSource,
                    "data" : aoData,
                    "success" : fnCallback
                });
            },
            "aaSorting" : [ [ 0, "desc" ] ],
			"bSort":true,
            "aoColumns" : [
            	{"sClass": "center", "bSortable": false,"mData": "studentNo"},
                {"sClass": "center", "bSortable": false,"mData":
					function(data){
                    	if(data.collegeName !=""){
                    	    return data.collegeName
						}else{
                            return "";
						}
					}
				},
                {"sClass": "center", "bSortable": false,"mData":
                    function(data){
                        if(data.courseName !=""){
                            return data.courseName
                        }else{
                            return "";
                        }
                    }
                },
                {"sClass": "center", "bSortable": false,"mData":
                    function(data){
                        if(data.majorName !=""){
                            return data.majorName
                        }else{
                            return "";
                        }
                    }
                },
                {"sClass": "center", "bSortable": false, "mData":
                	function (data) {
                    	if(data.studentConfirmUrl == "" || data.studentConfirmUrl == null){
                            return "";
						}else{
                            return  '<a href="javascript:void(0);"  onclick="filePreview(\'' + data.studentConfirmUrl +'\')">点击查看</a>';
						}

                	}},
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
						if(data.copyUrl == "" || data.copyUrl == null){
                            return "";
						}else{
                            return '<a href="javascript:void(0);"  onclick="filePreview(\'' + data.copyUrl +'\')">点击查看</a>';
						}

                    }},
                {"sClass": "center", "bSortable": false,"mData": "operatorName"},
                {"sClass": "center", "bSortable": false, "mData":
					function(data){
						if(data.createTime != null){
							return getTimeString_day(new Date(data.createTime))
						}else{
							return "";
						}
					}
				},
                {"sClass" : "center", "bSortable" : false, "mData" : function (data) {
                    var styleDiv = '';
                    var editOperation = '';
                    var deleteOperation = '';
//                    if($("#oaid").val() == data.operatorNo){
//                		 styleDiv='<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">';
//						 editOperation= '<a class="green" href="javascript:void(0);" onclick="toEditURL('+data.id+')">\n' +
//							'<i class="icon-pencil bigger-130"></i></a>\n' ;
//						 deleteOperation='<a class="red" href="javascript:void(0);"  onclick="toDeleteURL('+data.id+')">\n' +
//							'<i class="icon-trash bigger-130"></i></a>\n'+ '</div>';
//                    }
                    return styleDiv+editOperation+deleteOperation;
                }}
            ],
            "oLanguage" : {
                "sLengthMenu" : "每页 _MENU_条 ",
                "sZeroRecords" : "对不起，查询不到任何相关数据",
                "sInfo" : "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录 ",
                "sInfoEmpty" : "显示 0 到 0 条，共 0 条记录",
                "sInfoFiltered" : "数据表中共为 _MAX_ 条记录)",
                "sProcessing" : "正在加载中...",
                "sSearch" : "搜索",
                "sUrl" : "", //多语言配置文件，可将oLanguage的设置放在一个txt文件中，例：Javascript/datatable/dtCH.txt
                "oPaginate" : {
                    "sFirst" : "第一页",
                    "sPrevious" : " 上一页 ",
                    "sNext" : " 下一页 ",
                    "sLast" : " 最后一页 "
                }
            }
            //多语言配置

        });

        $("#query").click(function() {
            oTable1.fnDraw();
        })

    })

//跳转到添加页面
function toAddUrl(){
	location.href="/studentCopyInfo?studentNo="+$("#studentNo").val();
}



function toUrl(url){
    window.open(url);
}
function getTimeString_day(date) {
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	m = m >= 10 ? m : '0' + m;
	var d = date.getDate();
	d = d >= 10 ? d : '0' + d;
	return y + '-' + m + '-' + d;
}

function filePreview(attachment) {
	$.post("/getPrivateUrl",{"fileUrl":attachment},function (data,status) {
		window.open(data);
	});
}

</script>
</html>
